#!/usr/bin/env python3
# _*_ coding:utf-8 _*_
import sys
from git_python.gitTransfer import GitTransfer

if __name__ == "__main__":
    print("main")
    argvList = sys.argv
    gitDir = argvList[1]
    gitUrl = argvList[2]
    newGitUrl = argvList[3]

    print("gitDir", gitDir)
    print("gitUrl", gitUrl)
    print("newGitUrl", newGitUrl)

    repo = GitTransfer(gitDir, gitUrl, newGitUrl)
    bList = repo.get_local_need_rsync_branches()
    repo.fetch_remote_branches(bList)

    if repo.check_remote("gitlab.feeyo.com", newGitUrl):
        repo.add_remote("gitlab.feeyo.com", newGitUrl)
    else:
        print("cccccccccc")
        print("该远程名或仓库地址已存在!")

